# Contributor: David Demelier <markand@malikania.fr>
# Maintainer: David Demelier <markand@malikania.fr>
pkgname=cog
pkgver=0.12.4
pkgrel=0
pkgdesc="simple browser for WebKit WPE"
url="https://github.com/Igalia/cog"
# riscv64: wpewebkit not available.
arch="all !riscv64"
license="MIT"
makedepends="cairo-dev
	cmake
	eudev-dev
	libinput-dev
	libsoup3-dev
	libwpebackend-fdo-dev
	mesa-dev
	samurai
	wayland-dev
	wayland-protocols
	wpewebkit-dev
	"
source="https://github.com/Igalia/cog/releases/download/$pkgver/cog-$pkgver.tar.xz"
subpackages="$pkgname-dev $pkgname-doc"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DUSE_SOUP2=OFF \
		$CMAKE_CROSSOPTS .
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
d47c8d8ad7d0815f32f06b83abc816e55642c999802ee727c4ada9cb789ee14315b670a3263ff576a701db7064775e70ea73bc02a1b1efa64c192c38b1aeb644  cog-0.12.4.tar.xz
"
